package com.example.myapplication.RoomFile

import android.content.Context
import androidx.lifecycle.LiveData

class WordRepository(context: Context) {

    private var wordDao: WordDao
    var liveData: LiveData<List<Word>>

    init {
        val database: WordDatabase = WordDatabase.getInstance(context)
        wordDao = database.wordDao()
        liveData = wordDao.getAllWords()
    }

    fun insertWords(vararg words: Word){
        wordDao.insertWords(*words)
    }
    fun updateWords(word: Word){
        wordDao.updateWords(word)
    }
    fun deleteAll(){
        wordDao.deleteAll()
    }

    fun deleteWords(vararg word: Word){
        wordDao.deleteWords(*word)
    }
//    fun getAllWords(): LiveData<List<Word>>{
//        return wordDao.getAllWords()
//    }

}